<template>
  <div id="app">
    <div>
      <div style="display: inline-block">
        <label :for="i" v-for="(item, i) in arr" :key="i">
          {{ item }}
          <input type="checkbox" :id="i" name="checkeds" :value="item" v-model="checkeds" />
        </label>
      </div>
      <p>你选中的元素, 累加的值和为: {{ he }}</p>
    </div>
  </div>
</template>

<script>
export default {
  data: function () {
    return {
      arr: [9, 15, 19, 25, 29, 31, 48, 57, 62, 79, 87],
      checkeds: []
    }
  },
  computed: {
    he() {
      return this.checkeds.reduce((t, c) => t + c, 0)
    }
  }
}
</script>
<style></style>
